
//style
document.write('<link rel="shortcut icon" href="/favicon.ico" />');
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/lib/bootstrap/css/bootstrap.min.css" />');
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/lib/fontawesome/fontawesome4.5.css" />');
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/lib/jqueryui/jquery-ui.min.css" />');
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/css/comm.css?v='+now+'" />');
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/css/style.css?v='+now+'" />');
//javascript
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/js/jquery.min.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/js/jquery.cookie.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/bootstrap/js/bootstrap.min.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqueryui/jquery-ui.min.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/dialog/dialog.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/laydate/laydate.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/layout/jquery.layout.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/js/store.js"></script>');

// wdtree
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/lib/wdtree/tree.css" />');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/wdtree/tree.js"></script>');
// jquery.validate
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/validate/jquery.validate.min.js"></script>');
//select2 
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/lib/select2/select2.min.css" />');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/select2/select2.min.js"></script>');
//pinying
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/pinying/pinying.js"></script>');
//grid 
document.write('<link rel="stylesheet" type="text/css" href="' + RESOURCES_PATH + '/lib/jqgrid/jqgrid.css" />');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/jqgrid.min.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/grid.locale-cn.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/tableExport/tableExport.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/tableExport/jquery.base64.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/tableExport/html2canvas.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/tableExport/jspdf/libs/sprintf.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/tableExport/jspdf/jspdf.js"></script>');
document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/lib/jqgrid/tableExport/jspdf/libs/base64.js"></script>');

document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/js/luomingui.js?v='+now+'"></script>');

var skin=getCookie('skin');
if (!!skin) {
    document.write("<link href='" + RESOURCES_PATH + "/css/color" + skin + ".css?v=" + now + "' rel='stylesheet' type='text/css' id='cssfile'>");
} else {
    document.write("<link href='" + RESOURCES_PATH + "/css/color3.css?v=" + now + "' rel='stylesheet' type='text/css' id='cssfile'>");
}

document.write('<script type="text/javascript" src="' + RESOURCES_PATH + '/js/changeColor.js"></script>');

 //导出
function btn_export(type) {
    if (type == 'JSON') {
        $('#gridList').tableExport({ type: 'json', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'XML') {
        $('#gridList').tableExport({ type: 'xml', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'PNG') {
        $('#gridList').tableExport({ type: 'png', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'CSV') {
        $('#gridList').tableExport({ type: 'csv', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'TXT') {
        $('#gridList').tableExport({ type: 'txt', fileName: new Date().getTime(), escape: 'false', ignoreColumn: '[3]', });
    } else if (type == 'SQL') {
        $('#gridList').tableExport({ type: 'sql', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'Word') {
        $('#gridList').tableExport({ type: 'doc', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'Excel') {
        //$('#gridList').tableExport({ type: 'excel', escape: 'false', fileName: new Date().getTime() });
        var doExcel = function () {
            var tableid = "gridList";
            var thead = $("#gbox_" + tableid + ' .ui-jqgrid-htable thead');
            var ee = $('#' + tableid);
            //合并表头和表数据
            ee.find('tbody').before(thead);
            //底部有合计功能的话，还需要合并底部的tr
            var footer = $('.ui-jqgrid-ftable tbody tr.footrow')
            ee.find('tbody').append(footer)
            //通过完整的table导出excel
            ee.tableExport({
                type: 'excel',
                escape: 'false',
                fileName: new Date().getTime(),
                ignoreColumn: ['0']
            });
            //将原来的table还原
            var a = $("#" + tableid).find('thead');
            var _footer = $("#" + tableid).find('tr.footrow')
            //表头还原
            $("#gbox_" + tableid + ' .ui-jqgrid-htable').append(a);
            //底部合并还原
            $("#gbox_" + tableid + ' .ui-jqgrid-ftable').append(_footer)
        };
        doExcel();
    } else if (type == 'Powerpoint') {
        $('#gridList').tableExport({ type: 'powerpoint', escape: 'false', fileName: new Date().getTime() });
    } else if (type == 'PDF') {
    }
}
function getCookie(sName) {
    var aCookie = document.cookie.split("; ");
    var lastMatch = null;
    for (var i = 0; i < aCookie.length; i++) {
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0]) {
            lastMatch = aCrumb;
        }
    }
    if (lastMatch) {
        var v = lastMatch[1];
        if (v === undefined) return v;
        return unescape(v);
    }
    return null;
}
/** 数据 */
const chartType = {};
chartType["pie"] ={name:"饼图",icon:"/fwdt/static/lib/echarts/icon/pie.png"};
chartType["bar"] ={name:"柱状图",icon:"/fwdt/static/lib/echarts/icon/bar.png"};
chartType["line"] ={name:"折线图",icon:"/fwdt/static/lib/echarts/icon/line.png"};
chartType["scatter"] ={name:"散点图",icon:"/fwdt/static/lib/echarts/icon/scatter.png"};
chartType["funnel"] ={name:"漏斗图",icon:"/fwdt/static/lib/echarts/icon/funnel.png"};
chartType["gauge"] ={name:"仪表盘",icon:"/fwdt/static/lib/echarts/icon/gauge.png"};